﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using BLToolkit.Data;
using BLToolkit.DataAccess;
using BLToolkit.Mapping;
using BLL.Repository;
using Enities;

namespace BLL
{
    public class LuuTruDocGia:ILuuTruDocGia
    {
      
        public DataTable SelectAll()
        {
            using (DbManager db = new DbManager())
            {
                DataTable table = db.SetSpCommand("LayTatCa_DocGia").ExecuteDataTable();
                return table;
            }
        }
        public void Them(DocGia dg)
        {
            using (DbManager db = new DbManager())
            {
                db.SetSpCommand("[Them_DocGia]", dg.MaDocGia, dg.HoTenDocGia, dg.NgaySinh, dg.DiaChi, dg.Email,dg.LoaiDocGia).ExecuteNonQuery();
            }
        }
        public void Sua(DocGia dg)
        {
            using (DbManager db = new DbManager())
            {
                db.SetSpCommand("[Sua_DocGia]", dg.MaDocGia, dg.HoTenDocGia, dg.NgaySinh, dg.DiaChi, dg.Email,dg.LoaiDocGia).ExecuteNonQuery();
            }
        }
        public void Xoa(int MaDocGia)
        {
            using (DbManager db = new DbManager())
            {
                db.SetSpCommand("[Xoa_DocGia]", MaDocGia).ExecuteNonQuery();
            }
        }



        //public int TimKiem1(DocGia dg)
        //{
        //    using (DbManager db = new DbManager())
        //    {
        //       return db.SetSpCommand("[TK_TenDG]", dg.HoTenDocGia).ExecuteNonQuery();
        //    }
        //}

        //public void TimKiem(string HoTenDocGia)
        //{
        //    using (DbManager db = new DbManager())
        //    {
        //        db.SetSpCommand("[TK_TenDG]", HoTenDocGia).ExecuteNonQuery();
        //    }
        //}

        //public DataTable timkiem(string HoTenDocGia)
        //{
        //    using (DbManager db = new DbManager())
        //    {
        //        DataTable table = db.SetSpCommand("[TK_TenDG]", HoTenDocGia).ExecuteDataTable();
        //        return table;

        //    }
        //}
        public DataTable timkiemMa(int MaDocGia, string HoTenDocGia)
        {
            using (DbManager db = new DbManager())
            {
                DataTable table = db.SetSpCommand("[TK_DocGia]", MaDocGia, HoTenDocGia).ExecuteDataTable();
                return table;
            }
        }

    }
}
